package suanfa;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class test10 {
    public static void main(String[] args) {//9  7  3  1  5  4  6  2  4  4  6
        int[] a = {9, 4, 6, 7, 2, 4, 3, 1, 5, 4, 6};
        int[] b = solution(a);
        for (int arr : b
                ) {
            System.out.println(arr);
        }
    }

    public static int[] solution(int[] array) {
        List<Integer> list = new ArrayList<>();
        int[] a = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            if (array[i] % 2 == 1)
                list.add(array[i]);
        }
        for (int i = 0; i < array.length; i++) {
            if (array[i] % 2 == 0)
                list.add(array[i]);
        }

        return Arrays.stream(list.toArray(new Integer[0])).mapToInt(Integer::valueOf).toArray();

    }
}
